Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

224
Visualizações
Postman returns [object object ] and value is not passing

I'm working with postman automation

There is a vehicles array in the body

{
   "Vehicles":[
      {
         "car":"{{car}}",
         "bike":"{{bike}}"
      }
   ]
}

I need to change this like below

{
   "Vehicles":"[{{vehicles}}]"
}

So I have created a pre=request script

let car, bike;
var vehicles = {
    car: data.vehicles.car,
    bike: data.vehicles.bike
}
pm.variables.set("vehicles",vehicles);

I'm getting data from external data file and its as following

[
   {
      "Vehicles":[
         {
            "car":"BMW",
            "bike":"YAMAHA"
         }
      ]
   }
]

I have run it through collection runner. and got the request body as vehicles:[object object] The data is not passing

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here objects are coverted into a string. Due to this the string returned [object,object].Assuming you are using a JSON file for external source you can use JSON.stringify() to solve this. Change the following part of your code:

let car, bike;
var vehicles = {
    car: data.vehicles.car.stringify(),
    bike: data.vehicles.bike.stringify()
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda